package com.bolt.convention.data;

import java.util.Map;

/**
 * Created by Administrator on 2020/6/5.
 */
public class Returns {

    private Returns() {

    }

    public static MapResultMessage success(String message, Object value) {
        return new MapResultMessage()
                .setCode(MapResultMessage.MESSAGE_RESULT_TYPE.success.name())
                .setMessage(message)
                .put(value);
    }

    public static MapResultMessage success(String message, Map <String, Object> data) {
        return new MapResultMessage()
                .setCode(MapResultMessage.MESSAGE_RESULT_TYPE.success.name())
                .setMessage(message)
                .setData(data);
    }

    public static MapResultMessage success( Object value) {
        return new MapResultMessage()
                .setCode(MapResultMessage.MESSAGE_RESULT_TYPE.success.name())
                .put(value);
    }

    public static MapResultMessage success(String message) {
        return new MapResultMessage()
                .setMessage(message)
                .setCode(MapResultMessage.MESSAGE_RESULT_TYPE.success.name());

    }

    public static MapResultMessage success() {
        return new MapResultMessage()
                .setMessage(null)
                .setCode(MapResultMessage.MESSAGE_RESULT_TYPE.success.name());

    }

    public static MapResultMessage error(String message) {
        return new MapResultMessage()
                .setCode(MapResultMessage.MESSAGE_RESULT_TYPE.error.name())
                .setMessage(message);
    }


    public static MapResultMessage warning(String message) {
        return new MapResultMessage()
                .setCode(MapResultMessage.MESSAGE_RESULT_TYPE.warning.name())
                .setMessage(message);
    }

    public static MapResultMessage confirm(String message) {
        return new MapResultMessage()
                .setCode(MapResultMessage.MESSAGE_RESULT_TYPE.confirm.name())
                .setMessage(message);
    }
}

 